<?php
include($classes_path.'/class.newsDetails.php');
include($includes_path.'/pregReplace.inc.php');
$pagepost = new newsDetails();
$newsDetail = $pagepost->get_newsDetails($id, $page);

foreach($newsDetail as $item){

//    if($item['checkId']) == true && $item['draftCheck'] == true){
        print('<div class="newsItem">');
        print('<h1><a href="page/2/news/article/'.$item['id'].'/'.htmlentities(strtolower(str_replace( " ", "-", $item['title']))).'" title="'.$item['title'].'">'.$item['title'].'</a></h1>');
        print('<p><span class="smallGrey">By <a class="blacknbold" href="../pages/profile/user/'.$item['authorId'].'/'.$item['realAuthor'].'">'.ucfirst($item['author']).'</a> on '.$item['time'].' | Category: '.$item['category'].'</span></p>');
        print('<p>'.$item['summary'].'</p>');
        if($page == 2 && !empty($article)){
        if($item['gallery'] != ""){
            print('<div id="myGallery" class="svw">');
            print('<ul>');
            print($item['gallery']);
            print('</ul>');
            print('</div>');
        }
        }
        print('<p>'.nl2br($item['shortBody']).'</p>');
        if($item['links'] != ""){
            print('<ul class="inline">');
            print($item['links']);
            print('</ul>');
        }
        if($item['tags'] != ""){
            print('<div class="separator"></div>');
            print('<ul class="inline" id="tagbox">');
            print('<li><span class="count"><b>Tags: </b></span></li>');
            print(strtolower($item['tags']));
            print('</ul>');
        }
        print('</div>');
        if($page == 2 && !empty($article)){
            
        }
//    }
//
//    else{
//        print('<h1>Oops! we can not seem to find the page you are looking for</h1>');
//        print('<p>Might we interest you with <a href="../news">something else</a>?</p>');
//    }
}
